﻿using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using TSqlServer;

/// <summary>
/// TAdCustomer 的摘要说明
/// </summary>
public class TAdCustomer : TData
{
    const string CTableName = "t_ad_customer";//表名
    const string CKeyName = "customer_id";//主键名
	public TAdCustomer()
	{
        FTableName = CTableName;
        FKeyName = CKeyName;
	}
    public TAdCustomer(string sid)
    {
    	FTableName = CTableName;
        FKeyName = CKeyName;
        FKeyValue = sid;
    }

    #region 表中的字段
    private string FCustomerId;

    public string CustomerId
    {
        get { return FCustomerId; }
        set { FCustomerId = value; }
    }
    private string FName;

    public string Name
    {
        get { return FName; }
        set { FName = value; }
    }
    private string FName2;

    public string Name2
    {
        get { return FName2; }
        set { FName2 = value; }
    }
    private string FArea;

    public string Area
    {
        get { return FArea; }
        set { FArea = value; }
    }
    private string FCgroup;

    public string Cgroup
    {
        get { return FCgroup; }
        set { FCgroup = value; }
    }
    private string FClevel;

    public string Clevel
    {
        get { return FClevel; }
        set { FClevel = value; }
    }
    private string FAddr;

    public string Addr
    {
        get { return FAddr; }
        set { FAddr = value; }
    }
    private string FZip;

    public string Zip
    {
        get { return FZip; }
        set { FZip = value; }
    }
    private string FWww;

    public string Www
    {
        get { return FWww; }
        set { FWww = value; }
    }
    private string FBankName;

    public string BankName
    {
        get { return FBankName; }
        set { FBankName = value; }
    }
    private string FAccount;

    public string Account
    {
        get { return FAccount; }
        set { FAccount = value; }
    }
    private string FNotice;

    public string Notice
    {
        get { return FNotice; }
        set { FNotice = value; }
    }
    private string FInputer;

    public string Inputer
    {
        get { return FInputer; }
        set { FInputer = value; }
    }
    private DateTime FInputTime;

    public DateTime InputTime
    {
        get { return FInputTime; }
        set { FInputTime = value; }
    }
    #endregion

    public override void Select()
    {
        string strSql = GetSelectString();
        TSqlDB oDB = new TSqlDB(strSql);
        if (!oDB.EOF)
        {

            FCustomerId = oDB["customer_id"].ToString();
            FName = oDB["name"].ToString();
            FName2 = oDB["name2"].ToString();
            FArea = oDB["area"].ToString();
            FCgroup = oDB["cgroup"].ToString();
            FClevel = oDB["clevel"].ToString();
            FAddr = oDB["addr"].ToString();
            FZip = oDB["zip"].ToString();
            FWww = oDB["www"].ToString();
            FBankName = oDB["bankname"].ToString();
            FAccount = oDB["account"].ToString();
            FNotice = oDB["notice"].ToString();
            FInputer = oDB["inputer"].ToString();
            FInputTime = oDB["input_time"].ToDateTime();
        }
        oDB.Free();
    }

    //插入新记录。
    public void Insert()
    {
        string ExSql = "'" + FCustomerId + "','" + FName + "','" + FName2 + "','" + FArea + "','" + FCgroup + "','" + FClevel + "','" + FAddr + "','" + FZip + "','" + FWww + "','" + FBankName + "','" + FAccount + "','" + FNotice + "','" + FInputer + "','" + FInputTime + "'";
        base.Insert(ExSql);
    }
    //更新记录。
    public void Update()
    {
        string ExSql = " name ='" + FName + "', name2 ='" + FName2 + "', area ='" + FArea + "', cgroup ='" + FCgroup + "', clevel ='" + FClevel + "', addr ='" + FAddr + "', zip ='" + FZip + "', www ='" + FWww + "', bankname ='" + FBankName + "', account ='" + FAccount + "', notice ='" + FNotice + "', inputer ='" + FInputer + "', input_time ='" + FInputTime + "'";
        base.Update(ExSql);
    }
    //静态，可以不用创建对象即可调用。
    public static void DeleteByID(string sID)
    {
        TData.DeleteByID(sID, CTableName, CKeyName);
    }
}
